<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class Zw extends Controller
{
    // 职位管理页
    public function index()
    {
        $res = Db::table('position')
                ->alias('a')
                ->join('company c','c.company_id = a.company_id')
                ->where('position_status',0)
                ->order('position_id desc')
                ->select();
        // dump($res);
        // exit;
        $this->assign('res',$res);
        return $this->fetch();
    }
     // 职位详情页
     public function zwdetails($position_id)
     {
         $res=Db::table('position p')
         ->join('company c','c.company_id=p.company_id')
         ->where('position_id',$position_id)
         ->where('position_status',0)
         ->select();
         $this->assign("res",$res);
        //    dump($res);
            // die;
         return $this->fetch();
     }
      // 删除职位
      public function zwdelete($position_id)
      {
        $data = [
            'position_status'=>1,
          ];
          $res = Db::table('position')->where('position_id',$position_id)->update($data);
          if($res){
              return $this->success('删除成功','zw/index');
          }
          else{
            return $this->error('删除失败');
          }
      }
}
